<?php

namespace App\Http\Controllers\Common;

use App\Http\Controllers\BaseController;
use App\Models\Company;
use App\Services\Manger\MangerAccount;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redis;
use Maatwebsite\Excel\Facades\Excel;

class MangerController extends BaseController
{

    /**
     * 获取用户列表
     */

    public function getAccountList(Request $request)
    {
        $utype = $request->utype ?? 0;
        $isgetall = $request->isgetall ?? 0;
        // if (!in_array($utype, [2, 3, 4, 5, 6, 7, 8])) {
        //     return response()->json(['code' => '001', 'msg' => getMsgByCode('001')]);
        // }
        $list = MangerAccount::getAccountList($request, $this->mangerinfo['cpid'], $this->mangerinfo['sys_dpm_id'], $utype, $isgetall);
        return response()->json(['code' => '000', 'msg' => '操作成功', 'data' => $list]);
    }


    public function getcurrentompanyinfo(Request $request)
    {
        $info = Company::where(['id' => $this->mangerinfo['cpid']])->first();
        return response()->json(['code' => '000', 'msg' => '操作成功', 'data' => $info]);
    }
}
